﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class BusinessMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.Business>
    {
        public BusinessMap()
        {
            // table
            //ToTable("CMS_Business");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.UserId)
                .IsRequired();
            Property(t => t.Indent)
                
                .IsRequired();
            Property(t => t.Point)
                
                .IsRequired();
            Property(t => t.PayMoney)
                
                .HasPrecision(19, 4)
                .IsRequired();
            Property(t => t.Customer)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.CreateTime)
                
                .IsRequired();
            Property(t => t.Remark)
                
                .HasMaxLength(500)
                .IsRequired();
            Property(t => t.Flag)
                
                .IsRequired();

            // Relationships
            HasRequired(t => t.User)
               .WithMany(t => t.Business)
               .HasForeignKey(d => d.UserId);


            //InitializeMapping();
        }
    }
}

